///////////////////////////////////////////////////////////
// 
//  Horse.h
//
//  Wiicussion
//  HCI 575 Class project
//  Spring 2007
// 
//  Authors:  Jeremy Bennett
//            Adam Faeth
//            Michael Oren
//
///////////////////////////////////////////////////////////

#ifndef _HORSE_H_
#define _HORSE_H_

// Local Includes
#include "stdafx.h"
#include "Game.h"
#include "Sequence.h"
#include "Player.h"
#include "MyContext.h"

// SDL Includes

// System Includes
#include <vector>


using namespace std;

#ifndef _TIME_T_DEFINED
typedef long time_t;        /* time value */
#define _TIME_T_DEFINED     /* avoid multiple def's of time_t */
#endif

class Horse : public Game
{
  public:
    //Constructor/Destructor
    Horse(float fX, float fY, float fW, float fH, int playCount, int iInst, Player* curPlayers);
    ~Horse();

    void addIt(int note);
    bool checkIt(int note, bool timeMatched);
    void changeLevel(int newLevel);
    void reset(int playCount);
    
    virtual bool handleEvents();
    virtual bool postFrame();

    // Render the horse game
    virtual bool renderGame( MyContext *pContex );
    
	int getCurPlayer();

	void gameOver();

protected:
    bool _updateState();
    bool _updatePlaying( Player* p, int iMote );

    bool _nextPlayer();

  protected: 
    Sequence      _seq;
	Player*       _myPlayers;
        
  protected:

    // Difficulty Level
    int            _level;

    // Notes
    vector<int>    _notes;

    int            _curPos;
        
    // Players
    int            _nPlayer;
    vector<int>    _players;
    int            _curPlayer;
    int            _playersLeft;

    bool           _bPlaying[2];
    
    MyContext     * _pContext;
};

#endif // _HORSE_H_